V = Variables
C = Calculation functions
The VC10LPFilter function implements a first-order low-pass digital filter (RC filter) for WORD dimension data.
VC10LPFilter (Tsample, Tau, FilterIn, FilterOut)
Parameters:
| IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
|---|---|---|---|---|
| IN | SYSTEM | swTsample | W | Sample time filter (msec) [0÷32767]. |
| IN | SYSTEM | swTau | W | The filter time constant (ms) [0÷32767] |
| IN | GLOBAL | gwFilterIn | W | Value of the variable that you want to filter (UM) [-32768÷32767] |
| OUT | GLOBAL | gwFilterOut | W | Value of the filtered variable (UM) [-32768÷32767] |
La funzione VC10LPFilter implementa un filtro passa basso digitale del primo ordine la cui costante di tempo (Tau) è definita nei parametri passati alla funzione stesso. Supponendo di partire da un valore della variabile di ingresso pari a zero, l'uscita del filtro assume un valore pari al 63% dell'ingresso dopo il tempo Tau. Allo stesso modo la frequenza di taglio del filtro è
;---------------------------------------------
; Project : REG_012
; Module Name : ReadTemp
; Author :
; Description : Read temperature & filter
;---------------------------------------------
MAIN:
CALL ReadTemp
swTsample = 100 ;100 ms tempo campionamento filtro
swTau = 5000 ;5 sec costante di tempo filtro
VC10LPFilter (swTsample, swTau, gwFilterIn, gwFilterOut)
WAIT 1
JUMP MAIN